package top.kwanghuee.shop.order.controller;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import top.kwanghuee.domain.Order;
import top.kwanghuee.shop.service.OrderService;

import javax.annotation.Resource;

/**
 * @author: kwanghuee
 * @date: 2020/9/11 13:43
 */
@RestController
@Slf4j
public class OrderController {

    @Resource
    private OrderService orderService;

    @GetMapping("/order/{pid}")
    public Order createOrder(@PathVariable("pid") int pid) {
        return orderService.createOrder(pid);
    }

    //@GetMapping("/order/{pid}")
    //public int createOrder(@PathVariable("pid") int pid) {
    //    return orderService.createOrder2(pid);
    //}

    @GetMapping("/message/{msg}")
    public String message(@PathVariable("msg") String msg){
        return orderService.message(msg);
    }
}
